package com.dxyxx.db;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.database.sqlite.SQLiteDatabase.CursorFactory;

public class ShoppingCarDBHelper extends SQLiteOpenHelper {
	private static final int VERSION = 1;

	public ShoppingCarDBHelper(Context context, String name, CursorFactory factory, int version) {

		super(context, name, factory, version);
	}

	public ShoppingCarDBHelper(Context context, String name, int version) {
		this(context, name, null, version);
	}

	public ShoppingCarDBHelper(Context context, String name) {
		this(context, name, VERSION);
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		// TODO Auto-generated method stub
		System.out.println("create a database");
		db.execSQL("create table cart(id int,name varchar(20), amount int, description varchar(20),specification varchar(20), price varchar(10), thumbId varchar(200))");
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int arg1, int arg2) {
		db.execSQL("delete from cart");
		System.out.println("upgrade a database");
	}
}
